Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support filled beziercurve rendering #92

Merged
merged 4 commits into from
Oct 18, 2024
Merged

Conversation

goccy
Copy link
Owner

@goccy goccy commented Oct 18, 2024

resolve #24

The following codes outputs expected results.

package main

import (
	"context"

	"github.com/goccy/go-graphviz"
)

func main() {
	if err := _main(context.Background()); err != nil {
		panic(err)
	}
}

func _main(ctx context.Context) error {
	g, err := graphviz.New(ctx)
	if err != nil {
		return err
	}

	graph, err := g.Graph()
	if err != nil {
		return err
	}
	a, err := graph.CreateNodeByName("a")
	if err != nil {
		return err
	}
	b, err := graph.CreateNodeByName("b")
	if err != nil {
		return err
	}
	if _, err := graph.CreateEdgeByName("e", a, b); err != nil {
		return err
	}

	a.SetStyle(graphviz.WedgedNodeStyle)
	a.SetShape(graphviz.EllipseShape)
	a.SetFillColor("blue:red:yellow")

	b.SetShape(graphviz.BoxShape)
	b.SetStyle(graphviz.StripedNodeStyle)
	b.SetFillColor("blue:red:yellow")

	if err = g.RenderFilename(ctx, graph, graphviz.PNG, "test.png"); err != nil {
		return err
	}
	return nil
}

test

@goccy goccy merged commit e4e4dd3 into master Oct 18, 2024
6 checks passed
@goccy goccy deleted the support-filled-beziercurve branch October 18, 2024 08:19
@lubronzhan lubronzhan mentioned this pull request Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

node styles striped/wedged don't work
1 participant